﻿using Infrastructure.Config;
using System;
using System.Collections.Generic;
using System.Text;

namespace OtherLib.AliPay
{
    public class AliPayConfig
    {
        public readonly static string AppId;

        public readonly static string Getewayurl = "https://openapi.alipay.com/gateway.do";
        public readonly static string SignType = "RSA2";
        public readonly static string CharSet = "UTF-8";

        public readonly static string APP_PRIVATE_KEY;
        public readonly static string ALIPAY_PUBLIC_KEY;
        public readonly static string NotifyUrl;

        static AliPayConfig()
        {
            if (string.IsNullOrWhiteSpace(APP_PRIVATE_KEY))
            {
                var aliPayConfig = ApplicationConfig.GetConfig().GetSection("AliPay");

                AliPayConfig.AppId = aliPayConfig["AppId"];
                AliPayConfig.APP_PRIVATE_KEY = aliPayConfig["APP_PRIVATE_KEY"];
                AliPayConfig.ALIPAY_PUBLIC_KEY = aliPayConfig["ALIPAY_PUBLIC_KEY"];
                AliPayConfig.NotifyUrl = aliPayConfig["NotifyUrl"];
            }
        }
    }
}
